package com.stm.bi.enums;


import com.stm.framework.annotation.EnumValue;

/**
 * @author chenyingjun
 * @ClassDesc ES时间类型枚举
 * @date 2023/02/02 9:20
 **/
@EnumValue
public enum DateType {
    YEAR("year","年"),
    MONTH( "month","月"),
    WEEK("week","周"),
    DAY("day","日");
//    HOUR("hour","时段");

//    YEARLY("yearly","年度"),
//    MONTHLY( "monthly","月度"),
//    WEEKLY("weekly","周度"),
//    DAILY("daily","日度"),
//    HOURLY("hourly","时段");

    /**
     * 字段类型值
     */
    @EnumValue
    private final String value;
    /**
     * 字段类型描述
     */
    private final String desc;

    DateType(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static DateType getDateType(String value) {
        for (DateType ut : DateType.values()) {
            if (ut.getValue().equals(value)) {
                return ut;
            }
        }
        return null;
    }

    public String getValue() {
        return this.value;
    }

    public String getDesc() {
        return desc;
    }
}
